Allocate a large-enough and mask
authorMatthias Clasen <mclasen@redhat.com>
Sat, 28 Nov 2009 01:57:59 +0000 (20:57 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 28 Nov 2009 01:59:42 +0000 (20:59 -0500)
We came up short when the image width is not a multiple of 8.
Bug 585383, fix by Felix Riemann.

gdk-pixbuf/io-ico.c

index 4a6bad8703e1eb17e1b63fdcdf435fbc78db3244..e7fedb9295e97a2ac0960bbc5d0f01d8a3ab0786 100644 (file)
@@ -1011,12 +1011,12 @@ fill_entry (IconEntry *icon,
                return FALSE;
        }
 
-       if ((icon->xor_rowstride % 4) != 0)             
+       if ((icon->xor_rowstride % 4) != 0)
                icon->xor_rowstride = 4 * ((icon->xor_rowstride / 4) + 1);
        icon->xor = g_new0 (guchar, icon->xor_rowstride * icon->height);
 
-       icon->and_rowstride = icon->width / 8;
-       if ((icon->and_rowstride % 4) != 0)             
+       icon->and_rowstride = (icon->width + 7) / 8;
+       if ((icon->and_rowstride % 4) != 0)
                icon->and_rowstride = 4 * ((icon->and_rowstride / 4) + 1);
        icon->and = g_new0 (guchar, icon->and_rowstride * icon->height);